#!/usr/bin/env python
# encoding: utf-8

# URL设置
# Domain = ["172.18.33.152:8088", "172.18.33.154:8088"]
Domain = ["172.18.233.100:8088", "172.18.233.101:8088"]
DataDirect = "/data/data1/SimpleMongoiter/scrapy"
AppListURL = ["http://%s/cluster/scheduler" % i for i in Domain]
RunningURL = ["http://%s/cluster/apps/RUNNING" % i for i in Domain]
FailedURL = ["http://%s/cluster/apps/FAILED" % i for i in Domain]
KilledURL = ["http://%s/cluster/apps/KILLED" % i for i in Domain]
SteamDetailURL = ["http://%s/proxy/{App}/streaming" % i for i in Domain]

# Streaming普通监控参数设置
SuspendMax = 15  # 超过阈值则告警
SafeSuspend = 5  # 安全的范围
MaxSleepTime = {  # 正在运行的任务,如果陷入停滞状态,最长时间
    "wis1_ApAc": 200,
    "wis2_StaSyslog": 200,
    "wis3_StaRateInfo": 200,
    "wis4_Sta": 200,
    "wis5_ApRLQBegin": 200,
    "wis6_RadioAndSta_LQ": 200,
    "wis7": 200,
    "wis8": 200,
    "wis9": 200,
    "wis10": 200
}
ScheduleMinActive = 10  # 当前任务在指定时间MaxSleepTime内的移动的进度整体小于这个值则告警

# Streaming.Event监控参数设置
CheckEventListCount = 30  # 检查Event平均数量,最近几条
EventMinPer = 10  # event数量最小低于历史平均值得百分比
CheckEventHistoryLength = 5  # 连续出现异常的长度
EventAlarmCycle = 600  # 以秒为单位


FinishedCount = 10

# Running监控参数设置
# 设置每个Runing任务的最大运行时长
RunningCalcMaxTime = {
    'default': 60*30,  # 没有设置的默认读取这个值
    'wis_hour': 60*60,
    'wis_minute': 60*8,
    'wis_rrm': 60*15,
    'wis_day': 60*60*6,
    'wis_2_day': 60*60*8,
    'wis_2_day_AcConfig': 60*60*10,
    'wis_2_hour': 60*60,
    'wis_2_hour_upload': 60*30,
    'wis_2_hour_StaSysLog': 60*20,
    'wis_2_hour_staRate': 60*20,
    'wis_2_hour_ApRadio': 60*25,
    'wis_2_minute': 60*15,
    'wis_2_minute_ap': 60*40,
    'wis_2_minute_rrm': 60*15,
    'wis_2_minute_wids': 60*10,
    'wis_2_minute_ApCover': 60*10,
}
RunningAlarmPerInTime = 20  # 设置超过设置时长的百分比则报警
RunningStreamingLive = {
    "wis1_ApAc",
    "wis2_StaSyslog",
    "wis3_StaRateInfo",
    "wis4_Sta",
    "wis5_ApRLQBegin",
    "wis6_RadioAndSta_LQ",
    "wis7",
    "wis8",
    "wis9",
    "wis10"
}  # 监控Streaming的任务,配置需要监控的名称
RunningStreamingLoseTime = 1  # 失去存活的时间,超过报警


# Zabbix配置参数
# 输出目录设置
ZabbixOutPath = {
    "running": "/home/zabbix/data/running",
    "streaming": "/home/zabbix/data/streaming",
}


# 采集服务器地址
CollectServer = {
    "ip": "localhost",
    "port": 55555
}
WebServer = {
    "ip": "172.18.233.33",
    "port": 11111
}
CollectRedisServer = {
    "ip": "172.18.233.33",
    "port": 6379
}


# 批处理任务丢失时间阈值设置
BatchLoseJobMaxTime = {
    'default': 60*60*24,  # 没有设置的默认读取这个值
    'wis_2_day': 60*60*24*2,
    'wis_2_hour': 60*60*3,
    'wis_2_hour_upload': 60*60,
    'wis_2_hour_StaSysLog': 60*60,
    'wis_2_hour_staRate': 60*60,
    'wis_2_hour_ApRadio': 60*60,
    'wis_2_minute': 60*30,
    'wis_2_minute_ap': 60*30,
    'wis_2_minute_rrm': 60*30,
    'wis_2_minute_wids': 60*30,
    'wis_2_minute_ApCover': 60*30,
    'wis_day': 60*60*24*2,
    'wis_hour': 60*60*3,
    'wis_rrm': 60*60,
    'wis_minute': 60*30,
}

# Mongo服务器地址
MongoServer = [
    "172.18.233.160:26001",
    "172.18.233.162:26002",
    "172.18.233.164:26003",
    "172.18.233.166:26004",
    "172.18.233.168:26005",
    "172.18.233.170:26006",
    "172.18.233.172:26007",
    "172.18.233.174:26008",
    "172.18.233.176:26009",
]
MongoMonitorSetting = {
    "Replication": 300
}

RedisCliPath = '/usr/local/bin/redis-cli'

OnlineServer = {
    "Codis": [
        "172.18.233.220",    
        "172.18.233.221",    
        "172.18.233.222",    
        "172.18.233.223",    
        "172.18.233.224"    
    ],
    "MongoDB": [
        "172.18.233.160",    
        "172.18.233.161",    
        "172.18.233.162",    
        "172.18.233.163",    
        "172.18.233.164",    
        "172.18.233.165",    
        "172.18.233.166",    
        "172.18.233.167",    
        "172.18.233.168",    
        "172.18.233.169",    
        "172.18.233.170",    
        "172.18.233.171",    
        "172.18.233.172",    
        "172.18.233.173",    
        "172.18.233.174",    
        "172.18.233.175",    
        "172.18.233.176",    
        "172.18.233.177"    
    ],
    "Hadoop": [
        "172.18.233.100",    
        "172.18.233.101",    
        "172.18.233.102",    
        "172.18.233.103",    
        "172.18.233.104",    
        "172.18.233.105",    
        "172.18.233.106",    
        "172.18.233.107",    
        "172.18.233.108",    
        "172.18.233.109",    
        "172.18.233.110",    
    ],
    "采集集群": [
        "172.18.233.47",    
        "172.18.233.48",    
        "172.18.233.49",    
        "172.18.233.50",    
    ],
    "原始数据存储": [
        "172.18.233.3",    
    ]
}

# 通过CDH的api获取数据，并且微信告警
CDH = ["172.18.233.100:7180", "172.18.233.101:7180"]
CdhUser = 'admin'
CdhPassword = 'wisbigdata'
CdhQuerys = {
    'kafka_message': {
        'query': 'SELECT total_kafka_messages_received_rate_across_kafka_brokers WHERE entityName = "kafka" AND category = SERVICE',
        'type': 'rate',
        'min': 70,
        'max': 150
    },        
}
